import java.util.Scanner;

public class a010_因數分解 {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		
		int n;
		
		String result_str;
		String[] result_split;
		
		int counter;
		
		String output;
		
		while(input.hasNext()) {
			n = input.nextInt();
			
			result_str = "";
			
			// +int -> 2 ^ 31 = 2147483648 > n
			// +int -> 2 ^ 20 = 1048576 > 1000000
			for(int i = 1; i <= 20; i++) {
				if(Prime_determine (n)) {
					result_str += Integer.toString(n);
					break;
				}
				
				for(int j = 2; j <= n; j++) {
					if(Prime_determine (j)) {
						if(n % j ==0) {
							result_str += Integer.toString(j) + " ";
							n = n / j;
							break;
						}
					}
				}
			}
			
			result_split = result_str.split(" ");
			
			output = "";
			if(result_split.length == 1)
				output += result_split[0];
			else {
				counter = 1;
				for(int i = 0; i <result_split.length - 1; i++) {
					if(Integer.parseInt(result_split[i]) == Integer.parseInt(result_split[i + 1])) {
						counter ++;
						
						if(i == result_split.length - 1 - 1)
							output += result_split[i] + "^" + Integer.toString(counter);
					}
					else {
						if(counter == 1)
							output += result_split[i];
						else
							output += result_split[i] + "^" + Integer.toString(counter);
						
						output += " * ";
						
						counter = 1;
					}
				}
				
				if(counter == 1)
					output += result_split[result_split.length - 1];
			}
			
			System.out.println(output);
		}
	}
	
	//-----------------------------------------------------------------
	
	public static boolean Prime_determine(int n) {
		if(n == 2 || n == 3)
			return true;
		else if(n % 2 == 0)
			return false;
		else {
			int end = (int)Math.pow (n, 0.5);
			for(int i = 3; i <= end; i +=2) {
				if(n % i == 0)
					return false;
			}
		}
		return true;
	}
	
}